<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
        + request.getServerName() + ":" + request.getServerPort()
        + path + "/";
%>
<!DOCTYPE html>
<html lang="zh" >
<head>
	<base href="<%=basePath%>">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>用户个人信息</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="static/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="static/ajax/libs/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="static/css/animate.css" rel="stylesheet"/>
    <link href="static/css/style.css" rel="stylesheet"/>
    <link href="static/ruoyi/css/ry-ui.css" rel="stylesheet"/>
</head>

<body class="gray-bg" style="font: 14px Helvetica Neue, Helvetica, PingFang SC, 微软雅黑, Tahoma, Arial, sans-serif !important;">
<script>
</script>
<input id="userId" name="userId" type="hidden" value="1" />
<section class="section-content">
    <div class="row">
        <div class="col-xs-3 pr5">
            <div class="ibox float-e-margins">
                <div class="ibox-title ibox-title-gray dashboard-header gray-bg">
                    <h5>消息中心</h5>
                </div>
                <div class="ibox-content">
                    <div class="text-center">
                        <a class="menuItem btn btn-block btn-outline btn-primary" onclick="createMenuItem('system/send_message.jsp','消息通知编辑')">发送消息</a>
                    </div>
                    <ul class="list-group list-group-striped">
                        <li class="list-group-item"><i class="fa fa-user"></i>
                            <b class="font-noraml">收件箱：</b>
                            <p class="pull-right">${AdviseReceviseListSize}</p>
                        </li>
                        <li class="list-group-item"><i class="fa fa-phone"></i>
                            <b  class="font-noraml">发件箱：</b>
                            <p class="pull-right">${AdviseSendListSize}</p>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        
        <div class="col-xs-9" style="padding-left: 0px">
            <div class="ibox float-e-margins">
                <div class="ibox-title ibox-title-gray dashboard-header">
                    <h5>消息详情</h5>
                </div>
                <div class="ibox-content">
                    <div class="nav-tabs-custom">
                        <ul class="nav nav-tabs">
                            <li class="active"><a href="#message_get" data-toggle="tab" aria-expanded="true">收件箱</a></li>
                            <li><a href="#message_send" data-toggle="tab" aria-expanded="false">发件箱</a></li>
                        </ul>                      
                        <div class="tab-content">
                            <!--收件箱-->
                            <div class="tab-pane active" id="message_get">
                                <div class="panel-group" id="accordion">
                                <c:if test="${!empty AdviseReceviseList}">
                                <c:forEach var="AdviseRecord" items="${AdviseReceviseList}">
                                    <div class="panel panel-info">
                                        <div class="panel-heading">
                                            <h4 class="panel-title">
                                                <a data-toggle="collapse" data-parent="#accordion" href="tabs_panels.html#${AdviseRecord.adviseId}" class="collapsed" aria-expanded="false">
                                                    <p>通知标题：<span>${AdviseRecord.adviseTitle}</span></p>
                                                    <p>发件人：<span>${AdviseRecord.adviseSender}</span></p>
                                                    <p>通知类型：<span>${AdviseRecord.adviseType}</span></p>
                                                    <p>通知时间：<span>${AdviseRecord.adviseTime}</span></p>
                                                </a>
                                            </h4>
                                        </div>
                                        <div id="${AdviseRecord.adviseId}" class="panel-collapse collapse" aria-expanded="false">
                                            <div class="panel-body">
                                                ${AdviseRecord.adviseContent}
                                            </div>
                                        </div>
                                    </div>
                                </c:forEach>
                                </c:if>
                                <c:if test="${empty AdviseReceviseList}">
                                <p style="color:#EEEEEE;font-size:30px;">${messageRecevise}</p>
                                </c:if>
                                </div>
                            </div>

                            <!--发件箱-->
                            <div class="tab-pane" id="message_send">
                                <div class="panel-group" id="accordion2">
                                <c:if test="${!empty AdviseSendList}">
                                	<c:forEach var="AdviseRecord" items="${AdviseSendList}">
                                    <div class="panel panel-success">
                                        <div class="panel-heading">
                                            <h5 class="panel-title">
                                                <a data-toggle="collapse" data-parent="#accordion2" href="tabs_panels.html#${AdviseRecord.adviseId}" aria-expanded="true">
                                                	<p>通知标题：<span>${AdviseRecord.adviseTitle}</span></p>
                                                    <p>收件人：<span>${AdviseRecord.adviseReceviser}</span></p>
                                                    <p>通知类型：<span>${AdviseRecord.adviseType}</span></p>
                                                    <p>通知时间：<span>${AdviseRecord.adviseTime}</span></p>
                                                </a>
                                            </h5>
                                        </div>
                                        <div id="${AdviseRecord.adviseId}" class="panel-collapse collapse" aria-expanded="false">
                                            <div class="panel-body">
                                                ${AdviseRecord.adviseContent}
                                            </div>
                                        </div>
                                    </div>
                                    </c:forEach>
                                  </c:if>
                                  <c:if test="${empty AdviseSendList}">
                                <p style="color:#EEEEEE;font-size:30px;">${messageSend}</p>
                                </c:if>
                                </div>
                            </div>

                        </div>
                            
                        
                    </div>
                </div>
            </div>
        </div>
      </div>
</section>


<script src="static/js/jquery.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
<!-- bootstrap-table 表格插件 -->
<script src="static/ajax/libs/bootstrap-table/bootstrap-table.min.js"></script>
<script src="static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js"></script>
<script src="static/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js"></script>
<script src="static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="static/ajax/libs/validate/jquery.validate.min.js"></script>
<script src="static/ajax/libs/validate/messages_zh.min.js"></script>
<script src="static/ajax/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
<!-- jquery-export 表格导出插件 -->
<script src="static/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js"></script>
<script src="static/ajax/libs/bootstrap-table/extensions/export/tableExport.js"></script>
<!-- 遮罩层 -->
<script src="static/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="static/ajax/libs/iCheck/icheck.min.js"></script>
<script src="static/ajax/libs/layer/layer.min.js"></script>
<script src="static/ajax/libs/layui/layui.js"></script>
<script src="static/ruoyi/js/common.js"></script>
<script src="static/ruoyi/js/ry-ui.js"></script>
<script> var ctx = "\/"; </script>

<script>
    /*用户管理-头像*/
    function avatar() {
        var url = "";
        $.modal.open("修改头像", url);
    }

    /*用户信息-修改*/
    $("#form-user-edit").validate({
        onkeyup: false,
        rules:{
            userName:{
                required:true,
            },
            email:{
                required:true,
                email:true,
                remote: {
                    url: "",
                    type: "post",
                    dataType: "json",
                    data: {
                        "userId": function() {
                            return $("#userId").val();
                        },
                        "email": function() {
                            return $.common.trim($("#email").val());
                        }
                    },
                    dataFilter: function (data, type) {
                        return $.validate.unique(data);
                    }
                }
            },
            phonenumber:{
                required:true,
                isPhone:true,
                remote: {
                    url: "",
                    type: "post",
                    dataType: "json",
                    data: {
                        "userId": function() {
                            return $("#userId").val();
                        },
                        "phonenumber": function() {
                            return $.common.trim($("#phonenumber").val());
                        }
                    },
                    dataFilter: function (data, type) {
                        return $.validate.unique(data);
                    }
                }
            },
        },
        messages: {
            "userName": {
                required: "请输入用户名称",
            },
            "email": {
                required: "请输入邮箱",
                remote: "Email已经存在"
            },
            "phonenumber":{
                required: "请输入手机号码",
                remote: "手机号码已经存在"
            }
        },
        focusCleanup: true
    });

    function submitUserInfo() {
        if ($.validate.form()) {
            $.operate.saveModal(ctx + "system/user/profile/update", $('#form-user-edit').serialize());
        }
    }

    
    /*用户管理-修改密码*/
    $("#form-user-resetPwd").validate({
        onkeyup: false,
        rules:{
            oldPassword:{
                required:true,
                remote: {
                    url: "",
                    type: "get",
                    dataType: "json",
                    data: {
                        password: function() {
                            return $("input[name='oldPassword']").val();
                        }
                    }
                }
            },
            newPassword: {
                required: true,
                minlength: 6,
                maxlength: 20
            },
            confirmPassword: {
                required: true,
                equalTo: "#newPassword"
            }
        },
        messages: {
            oldPassword: {
                required: "请输入原密码",
                remote: "原密码错误"
            },
            newPassword: {
                required: "请输入新密码",
                minlength: "密码不能小于6个字符",
                maxlength: "密码不能大于20个字符"
            },
            confirmPassword: {
                required: "请再次输入新密码",
                equalTo: "两次密码输入不一致"
            }

        },
        focusCleanup: true
    });

    function submitChangPassword () {
        if ($.validate.form("form-user-resetPwd")) {
            $.operate.saveModal(ctx + "system/user/profile/resetPwd", $('#form-user-resetPwd').serialize());
        }
    }
</script>
</body>
</html>
